package file;

import java.io.File;

public class DeleteDemo {
    public static void main(String[] args) {
        File file = new File("name.txt");
        if(file.exists()){
            file.delete();
            System.out.println("文件已经删除");
        }else {
            System.out.println("文件不存在");
        }

        System.out.println("------------------------------------");


        File dir = new File("demo");
        if(dir.exists()){
            dir.delete();
            System.out.println("目录已经删除");
        }else {
            System.out.println("目录不存在");
        }
        dir.getName();
        dir.length();
        dir.canRead();
        dir.canWrite();
        dir.exists();
        dir.delete();
        dir.isFile();
        dir.isDirectory();


    }
}
